home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
batchut
/
bcsrce2.zip
/
CHEKBOX2.BC
< prev
next >
Wrap
Text File
|
1990-10-15
|
3KB
|
122 lines
let %!a = %1
if %!a# = # goto ERROR
let %!z = %!a
gt %!z 21
if errorlevel 1 goto ERROR
if %!a = 0 Let %!a = 10
goto TEST1
:TEST1
let %!b = %2
if %!b# = # goto ERROR
let %!z = %!b
gt %!z 65
if errorlevel 1 goto ERROR
if %!b = 0 Let %!b = 30
erase yes.yes > nul
erase no.no > nul
let %!p = %3
if %!p# = # let %!p = y
lower %!p
if %!p = yes let %!p = y
if %!p = y let %!e = 1
if %!p = no let %!p = n
if %!p = n let %!e = 1
if not %!e@ = 1@ goto ERROR
if %!p = y GOSUB YES
if %!p = n GOSUB NO
goto CHOOSE
:YES
locate %!a %!b
echonolf ╔═════╗ ┌─────┐
let %!s = %!a
add %!s 1
locate %!s %!b
echonolf ║ Yes ║ │ No! │
add %!s 1
locate %!s %!b
echonolf ╚═════╝ └─────┘
return
:NO
locate %!a %!b
echonolf ┌─────┐ ╔═════╗
let %!s = %!a
add %!s 1
locate %!s %!b
echonolf │ Yes │ ║ No! ║
add %!s 1
locate %!s %!b
echonolf └─────┘ ╚═════╝
return
:CHOOSE
rem 3840=Shift tab, 121=y, 110=n, 89=Y, 78=N, 27=Esc, 13=Enter, 9=Tab
rem Left arrow=19200, Right arrow=19712
getkey
if errlevel 19712 GOTO ARROW
if errlevel 19200 GOTO ARROW
if errlevel 3840 GOTO ARROW
if errlevel 121 GOTO MAKEYES
if errlevel 110 GOTO MAKENO
if errlevel 89 GOTO MAKEYES
if errlevel 78 GOTO MAKENO
if errlevel 27 GOTO END
if errlevel 13 GOTO ENTER
if errlevel 9 GOTO ARROW
goto CHOOSE
:ARROW
if %!p = y GOTO YES_NO
if %!p = n GOTO NO_YES
goto CHOOSE
:YES_NO
GOSUB NO
let %!p = n
goto CHOOSE
:NO_YES
GOSUB YES
let %!p = y
goto CHOOSE
:ENTER
if %!p = y GOTO MAKEYES
if %!p = n GOTO MAKENO
:MAKEYES
GOSUB YES
TYPE YES.YES > YES.YES
GOTO END
:MAKENO
GOSUB NO
TYPE NO.NO > NO.NO
GOTO END
:SYNTAX
echo.
echo SYNTAX---: CHEKBOX [ROW(1-21)] [COLUMN(1-65)] [yes]/[no]
echo USAGE----: Use in .BAT programs to interreact with users. Program-
echo mer positions a yes/no check box at given row/column
echo coordinates. An option is provided to preselect either
echo yes or no. The default is CHEKBOX 10 30 yes.
echo You can choose the defaults by using CHEKBOX 0 0 so long
echo as they are not out of alignment. In other words, yes or
echo no MUST be the third parameter, parameter two cannot ex-
echo ceed 65, and parameter one must be less than 22. User
echo has these keypresses to choose from left/right cursor,
echo tab, shift tab, Enter, ESCape, Y, y, N, and n.
echo.
echo EXAMPLE--: CHECKBOX 17 30 no
echo EXAMPLE--: CHEKBOX 5 0 {column 30 and yes is defaulted to}
echo EXAMPLE--: CHEKBOX 0 0 {row 10, column 30 and yes is defaulted to}
echo Only the yes/no can be omitted.
echo.
echo One of two zero byte files are created dependent upon user's choice.
echo If yes, YES.YES. If no, NO.NO. Use IF EXIST for the test.
echo.
echo Public Domain BATCOM program example, 1990, by Felix A. Rozewicz
goto END
:ERROR
echo Unable to verify validity of first 2 primary parameters.
echo Or, there is an error in typing yes/no parameter.
beep
echo.
waitkey 2
goto SYNTAX
:END
EXIT